<? if ($c = stack('name')) {

	$d = component_data($c); 
	$s = component_settings($c);

startScript(); ?><script type="text/javascript">jQuery(function($) {

	$("#cpn-<?=$c?>-content .scrollable").scrollable({
		size:4,
		disabledClass: "disabled",
		mousewheel:true
	}).navigator();
	
	$("#cpn-<?=$c?>-content .scrollable .items img").click(function() {
		var self = $(this); url = self.attr("data-url"); h = self.attr("data-h");
		var wrap = $("#cpn-<?=$c?>-content .image-wrap").fadeTo(100, 0.5);

		var img = new Image();
		img.onload = function() {
			wrap.fadeTo(100, 1);
			wrap.find("img").attr("src", url).attr("height", h);
		};
		img.src = url;
		
		return false;
	}).filter(":first").click();
	
});</script><? endScript();


	?><div id="cpn-<?=$c?>" class="cpn-album-gallery"><?

	if ($s['caption']) { ?><div class="cpn-album-caption"><?=$s['caption']?></div><? }
	
	?><div id="cpn-<?=$c?>-content" class="cpn-album-gallery-content"><?

		?><h2 class="cpn-album-gallery-title"><?=$s['gallery-title']?></h2><?
		?><div class="cpn-album-gallery-back"><a href="<?=_transformURL($CURRENT->url, array('remove_param' => $s['gparam']))?>" title="Все галереи">Все галереи</a></div><?
		?><div class="clearer"></div><?

	if (sizeof($d)) {
		

		?><div class="navi"></div><?

		?><a class="prev browse left"></a><div class="scrollable"><div class="items"><?
	
		foreach($d as $im => $info) {	
			 ?><div class="container"><div class="wrapper"><img src="<?="$s[path]/$info[tn]"?>" data-url="<?="$s[path]/$im"?>" data-h="<?=$info['h']?>" /></div></div><?
		} 
	
		?></div></div><a class="next browse right"></a><?
		
		?><div class="clearer"></div><?
		
		?><div class="image-wrap"><div class="wrapper">
			<img src="/img/blank.gif" height="<?=$s['h']?>" />
		</div></div><?

		}

	
	?></div><?
	
	?></div><?

 
	unstack();
} ?>